import java.util.ArrayList;

public class Problem12 {
	public static void main(String[] args) {
		ArrayList<Integer> arr = new ArrayList<Integer>();
		arr.add(2);
		for(int i = 2 ; i <= 1000; i ++ ) {
			ArrayList<Integer> tmp = multiple(arr);
			arr = tmp;
		}
		int sum = 0;
		for(int i = 0 ; i < arr.size() ; i ++ ) {
			sum += arr.get(i);
		}
		System.out.println(""+sum);
	}

	public static ArrayList<Integer> multiple(ArrayList<Integer> arr) {
		ArrayList<Integer> res = new ArrayList<Integer>();
		int carry = 0;
		for(int i = 0 ; i < arr.size() ; i ++ ) {
			int tmp = arr.get(i);
			int num = (tmp*2+carry)%10;
			res.add(num);
			carry = (tmp*2+carry)/10;
		}
		if(carry > 0) {
			res.add(carry);
		}
		return res;
	}
}
